1. Field of the Invention
The present invention relates to a managing method for a buffer, and more particularly, to a multi-section managing method and structure for a buffer used in a disk drive.
2. Description of the Prior Art
As network and hardware technology of computers advances, the need for data storing media increases. Multimedia, such as music data, even when processed with compression technology still occupies much space, and thus data storing media such as magneto-optical (MO), CD-R, CD-RW, and JAZZ have been developed. Especially important is the optical disk family, because of the popularity of audio CDs and CD-ROMs, CD-R and CD-RW were accepted into the market rapidly. As the costs of CD recorders and CD-R disks are constantly decreasing and CDs are often included as supplements to books and magazines, the optical disk and the disk drive is an important part of daily life.
FIG. 1 is a block diagram of a recordable disk drive according to the prior art. While recording, the disk drive receives data from an ATAPI/SCSI interface 90 at a buffer 70, and an error correcting code (ECC) encoder 40 generates an ECC of the received data in the buffer 70. Following this, a buffer managing unit 50 transmits the data having the ECC to a cross interleave Reed-Solomon code (CIRC) encoder 30 to generate a CIRC of the data. Finally, a pickup head 20 records the data having the ECC and the CIRC onto the optical disk 10. In said procedure, the buffer managing unit 50 manages the sequence of ECC encoding and the access time of the data in the buffer 70. Generally speaking, the buffer 70 is usually a DRAM.
On the other hand, when the disk drive outputs data, the data having the ECC and the CIRC are transmitted from the pickup head 20 to a CIRC decoder 60 for decoding. Following this, the CIRC decoded data is transmitted to the buffer 70, and an ECC decoder 80 decodes the ECC of the data in the buffer 70. Finally, the buffer managing unit 50 outputs the ECC decoded data in the buffer 70 to the ATAPI/SCSI interface 90. In said procedure, the buffer managing unit 50 is used for managing the sequence of ECC decoding and the access time of the data in the buffer 70.
Generally speaking, the buffer managing unit 50 has a plurality of registers for managing access of the data in the buffer 70. The plurality of registers includes a pointer register of a received data block (simply called Buffer_ptr), a pointer register of a decoded data block (simply called Decode_ptr), a pointer register of a transmitted data block (simply called Transmit_ptr), and an end block register (simply called End_BLK).
The storage space of the buffer 70 is capable of providing a fixed capacity such as 2 Kbytes as a block, and data is accessed or decoded by block. The End_BLK is used for setting a number of blocks. For example, if the content of the End_BLK is set to N, it indicates that the buffer 70 has N blocks (B0˜BN-1), each block being 2 Kbytes. As shown in FIG. 2a, at the initial state of reading data from disk, Buffer_ptr, Decode_ptr, and Transmit_ptr point to the same initial block (B0).
As shown in FIG. 2b, when the buffer 70 starts receiving the CIRC decoded data, the content of the Buffer_ptr points to the first block storing the data and then successively points to the next blocks as the amount of received data increases.
As shown in FIG. 2c, when the buffer 70 has the data stored in the blocks, the ECC decoder 80 decodes ECC of the data a block at a time. The data after executing ECC decoding is put into the original block, and the content of the Decode_ptr points to the decoded block and then successively points to the next block as the ECC decoded data increases.
As shown in FIG. 2d, when the data in the buffer 70 is decoded, the buffer managing unit 50 outputs the data block by block. The content of the Transmit_ptr points to the block preparing to output and then successively points to the next block as the output data increases.
The buffer 70 according to the prior art operates cyclically. For example, after the content of the Buffer_ptr points to the last block (set by End_BLK), that is, points to the block BN-1, the content of the Buffer_ptr will subsequently point to the initial block, that is, the block B0. Similarly, Decode_ptr and Transmit_ptr also operate in the same way.
The buffer 70 according to the prior art further has a pre-buffering function. For example, if a host (not shown) only requests to read the data until the block B10, because of the pre-buffering function, the data after the block B10 will be read by the pickup head and be stored. The merit of the pre-buffering function is that when the host requests the data after the block B10 again, the buffer managing unit sends a hit condition and outputs the data directly. Therefore, the time of driving the pickup head 20 to search the data on the optical disk is saved. When the data that the host needs is not in the buffer 70, that is, a miss condition, the pickup head 20 must seek another track to read new data. At this time, Buffer_ptr, Decode_ptr, and Transmit_ptr point to the same initial block B0 again. In other words, the data originally stored in the buffer 70 are abandoned.
In the reading procedure, when the pickup head 20 has to skip to another track to read data and then come back to the original track to read data, because the original data in the buffer 70 are abandoned by the miss condition, the pickup head has to reread the abandoned data in the original track.
The above-described condition occurs frequently in Mount Rainier disks. If some problem occurs in successive writing to the Mount Rainier disk, the data having the problem will be written to a specific area of the optical disk. This results in discontinuous data. When the pickup head 20 reads the Mount Rainier disk, it has to skip to the specific area to read data and then come back to the original track. This action of skipping tracks results in the pickup head repeatedly or redundantly reading data and reduces the effectiveness of the disk drive.